<?php
require_once('load.inc.php');
class Config
{
	var $config = array();
	var $is_loaded = array();
	var $_config_path = array();
	
	function __construct()
	{
		$this->config = &get_config();
		if ($this->config['base_url'] == '')
		{
			if (isset($_SERVER['HTTP_HOST']))
			{
				$base_url = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off' ? 'https' : 'http';
				$base_url .= '://'. $_SERVER['HTTP_HOST'];
				$base_url .= str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);
			}

			else
			{
				$base_url = 'http://localhost/RESTphp/';
			}

			$this->set_item('base_url', $base_url);
		}
	}
	private function set_item($item, $value)
	{
		$this->config[$item] = $value;
	}
}
?>